package com.sky.mapper;

import com.sky.entity.OrderDetail;
import com.sky.entity.Statistics;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface OrderDetailMapper {

    /**
     * @param: [orderId]
     * @return: java.util.List<com.sky.entity.OrderDetail>
     * @description: 根据 orderId查询order_detail数据
     **/
    @Select("select * from order_detail where order_id=#{orderId}")
    List<OrderDetail> getByOrderId(Long orderId);

    /**
     * @param: [orderDetailList]
     * @return: void
     * @description: 批量插入数据
     **/
    void insertBatch(List<OrderDetail> orderDetailList);

    @Select("select status, count(*) as count from orders group by status having status in (2,3,4)")
    List<Statistics> statistics();
}
